#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("subtract.in" , "r" , stdin);
	freopen("subtract.out" , "w" , stdout);
	int f[35];
	memset(f , 0 , sizeof f);
	int x , i = 0;
	while(cin >> x){
		f[i] = x;
		i++;
	}
	int len = --i;
	f[i]--;
	while(f[i] < 0){
		f[i] += 10;
		i--;
		f[i]--;
	}
	for(int i = 0 ; i <= len ; i++){
		if(i == 0 && f[i] == 0 && len > 0) continue;
		cout << f[i] << " ";
	}
	cout << endl;
	return 0;
}